#-*-coding:utf-8-*- 
import os
import os.path
import re

packDir='/home/mao/git_workspace/data-warehouse/ods/lbss'

#p1 = re.compile(r"\t")

p1 = re.compile(r"sqoop_import_216")

content = "sqoop_import"
def processDir(args,dirname,filenames):
	i=0
	
	for f in filenames:
		data=''
		filObj = open(dirname+"/"+f)
		for line in filObj:
			line = re.sub(p1,content,line)
			data +=line
		print data
		filObj.close()
		filewr=open(dirname+"/"+f,'w')
		filewr.write(data)
		filewr.close
		i=i+1
		print i,'file: ',dirname,'/',f
		print '-------------------------------------------------------------------'

def search():
	os.path.walk(packDir,processDir,None)

if __name__=='__main__':
	search()
